# -*- coding: UTF-8; indent-tabs-mode:nil; tab-width:4 -*-

# This file is part of DITA DTD Generator.
#
# DITA DTD Generator is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# DITA DTD Generator is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with DITA DTD Generator.  If not, see <http://www.gnu.org/licenses/>.

class Entity(object):
    """Base for entities."""
    _name = None
    _value = None
    def __init__(self, name, value=None):
        self._name = name
        self._value = value
    def get_name(self):
        """Get entity name."""
        return self._name
    def get_value(self):
        """Get entity value."""
        return self._value
class ParameterEntity(Entity):
    """Base for parameter entities."""
    def __init__(self, name, value=None):
        Entity.__init__(self, name, value)
    def __str__(self):
        return "%%%s;" % self._name
class GeneralEntity(Entity):
    """Base for general entities."""
    def __init__(self, name, value=None):
        Entity.__init__(self, name, value)
    def __str__(self):
        return "&%s;" % self._name
class GlobalAtts(ParameterEntity):
    #_value = u"""xtrc CDATA #IMPLIED
    #             xtrf CDATA #IMPLIED"""
    def __init__(self):
        ParameterEntity.__init__(self, u"global-atts", u"")

class Attribute(object):
    _name = None
    _attr_type = None
    _default = None
    def __init__(self, name, attr_type, default):
        self._name = name
        self._attr_type = attr_type
        self._default = default
    def get_name(self):
        return self._name
    def get_type(self):
        return self._attr_type
    def get_default(self):
        return self._default
    def __str__(self):
        return "%s %s %s" % (self._name, self._attr_type, self._default)

class Element(object):
    """Base for elements."""
    _name = None
    _model = None
    _attrs = None
    def __init__(self):
        pass
    def get_name(self):
        """Get element name."""
        return self._name
    def get_model(self):
        """Get element content model."""
        return self._model
    def get_attributes(self):
        """Get element attributes."""
        return self._attrs
